import { _decorator, Button, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
import { l10n } from 'db://localization-editor/l10n'

@ccclass('ButtonControl')
export class ButtonControl extends Component {
    start() {
        // this.node.on(Node.EventType.TOUCH_START,this._touch_start,this)不行，会触发两次
        this.node.on(Button.EventType.CLICK, this.changeLang, this);
     
    }

    update(deltaTime: number) {

    }
    changeLang() {
        if (l10n.currentLanguage === 'en') {
            l10n.changeLanguage('ar')
        } else {
            l10n.changeLanguage('en')
        }
    }
}


